<template>
    <div class="planb">
       
<el-row :gutter="0">
 <el-col :xs="24" :sm="6" :md="5" :lg="4"  >
        <div style="text-align: center; color: #0fa8e7">数据选择</div>
<el-input
  placeholder="输入关键字进行过滤"
  v-model="filterText">
</el-input>
       <el-tree

  :data="tree"
  :props="defaultProps"

  :filter-node-method="filterNode"
  ref="tree">
</el-tree>
 </el-col>

 <el-col :xs="24" :sm="18" :md="18.7" :lg="20" id="drag-content">
      <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="68px">
      <el-form-item label="场地名称" prop="name">
        <el-input
          v-model="queryParams.name"
          placeholder="请输入场地名称"
          clearable
          size="small"
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      
      <el-form-item>
        <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
        <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
      </el-form-item>
    </el-form>

    <el-row :gutter="10" class="mb8">
      <el-col :span="1.5">
        <el-button
          type="primary"
          plain
          icon="el-icon-plus"
          size="mini"
          @click="handleAdd"
          v-hasPermi="['exam:address:add']"
        >新增</el-button>
      </el-col>
      <el-col :span="1.5">
        <el-button
          type="success"
          plain
          icon="el-icon-edit"
          size="mini"
          :disabled="single"
          @click="handleUpdate"
          v-hasPermi="['exam:address:edit']"
        >修改</el-button>
      </el-col>
      <el-col :span="1.5">
        <el-button
          type="danger"
          plain
          icon="el-icon-delete"
          size="mini"
          :disabled="multiple"
          @click="handleDelete"
          v-hasPermi="['exam:address:remove']"
        >删除</el-button>
      </el-col>
      <el-col :span="1.5">
        <el-button
          type="warning"
          plain
          icon="el-icon-download"
          size="mini"
          :loading="exportLoading"
          @click="handleExport"
          v-hasPermi="['exam:address:export']"
        >导出</el-button>
      </el-col>
      <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
    </el-row>


       <el-table
    :data="tableData"
    border
    style="width: 100%">
    <el-table-column
      fixed
      prop="date"
      label="楼栋名称"
      width="150">
    </el-table-column>
     <el-table-column
      fixed
      prop="data1"
      label="房号"
      width="150">
    </el-table-column>
      <el-table-column
      fixed
      prop="date3"
      label="id"
      width="150">
    </el-table-column>
     <el-table-column
      fixed
      prop="date3"
      label="是否开放"
      width="150">
    </el-table-column>
     <el-table-column
      fixed
      prop="date3"
      label="最近操作时间"
      width="150">
    </el-table-column>
   
    <el-table-column
      fixed="right"
      label="操作"
      width="100">
      <template slot-scope="scope">
        <el-button @click="handleClick(scope.row)" type="text" size="small">修改</el-button>
        <el-button type="text" size="small">删除</el-button>
      </template>
    </el-table-column>
  </el-table>
  </el-col>
     </el-row>
    </div>
</template>
<script>
export default {
    name:"MyPlanb",
     methods: {
      handleClick(row) {
        console.log(row);
      }
    },
     data() {
      return {
              // 遮罩层
      loading: true,
      // 导出遮罩层
      exportLoading: false,
      // 选中数组
      ids: [],
      // 非单个禁用
      single: true,
      // 非多个禁用
      multiple: true,
      // 显示搜索条件
      showSearch: true,
      // 总条数
      total: 0,
      // 考场管理表格数据
      addressList: [],
      // 弹出层标题
      title: "",
      // 是否显示弹出层
      open: false,
      // 查询参数
      queryParams: {
        pageNum: 1,
        pageSize: 10,
        name: null,
        code: null,
        capacity: null,
        address: null,
        state: null,
        addressExplain: null
      },
      // 表单参数
      form: {},
      // 表单校验
      rules: {
        // name: [
        //   { required: true, message: "场地名称不能为空", trigger: "blur" }
        // ],
      },
          defaultProps: {
          children: 'children',
          label: 'label'
        },
              tree: [ {
          id: 1,
          label: '广州校区',
          children: [{
            id: 4,
            label: '教学楼',
           
          },{
            id: 5,
            label: '宿舍楼',
           
          }]
        },{
          id: 2,
          label: '深圳校区',
          children: [{
            id: 6,
            label: '教学楼',
           
          },{
            id: 7,
            label: '宿舍楼',
           
          }]
        }],
       
      filterText:"",
        tableData: [{
          date: '教学楼',
          data1:501
         
        }, {
          date: '实验楼',
          data1:505
        }, ]
      }
    },
     watch: {
      filterText(val) {
        this.$refs.tree.filter(val);
      }
    },
    methods:{
        handleNodeClick(data) {
        console.log(data);

      },
       filterNode(value, data) {
        if (!value) return true;
        return data.label.indexOf(value) !== -1;
      }}
    
}
</script>